nwnfandomcom-20200213-history
SPELL *
The SPELL_* and SPELLABILITY_* constants are used in NWScript to identify spells, spell-like abilities, the results of many activated non-combat feats, and basically every other instance of a character actively causing a script to be run, excluding events. For simplicity, all of these will be called "spells" in this article. The values of these constants are the row numbers corresponding to the spells in spells.2da. For spells that have subspells (e.g. protection from alignment), there are constants for both the master spell and the subspells. Whenever a script deals with an actual casting of a spell — such as telling a creature to cast a spell or checking the identity of a spell that was just cast — the constants for the master spells are not used. There are a few exceptions (the script x2_s2_gwildshp supports the shifter forms being used from their various master feats instead of an exact form being specified), but only a few. Some entries in spells.2da correspond to secondary results of other abilities, such as when a particular card is drawn from the deck of hazards. (Using the deck is one spell; each card can be its own spell.) These spells will be identified as "a result of" the spell it is secondary to. Unlike subspells, the master spell is cast, and from within the master spell, an instruction is issued to cast the secondary spell. (In contrast, a subspell is cast instead of the master spell.) An interesting use of spells.2da are the rows that do not fire a script. BioWare added a few such rows purely for the visual effects they produce, primarily the projectile. These spells are identified as "X visual effect" and can be cast via scripting, even though such a casting will not cause anything to happen in the game other than the visual effect. In a sense, these spells are "fake cast" even when nominally being cast normally. During the development of the game, changes were made as to what would be included in the final product. At times features were dropped, but time was not spent to remove all traces of dropped features. This is evident among the SPELL_* and SPELLABILITY_* constants, as there are several that have been defined in NWScript even though they now correspond to starred-out rows in spells.2da. Such constants are listed below for completeness even though they have no use in scripts. Spells The SPELL_* constants are used for all spells that a player can cast, as well as for some other abilities (that possibly could have been given SPELLABILITY_* constants, but were given SPELL_* constants instead). Spell-like abilities The SPELLABILTY_* constants generally cover most of the scripted abilities that are not cast from a spellbook, excluding those that were given SPELL_* constants (for unknown reasons, possibly just oversights). Other abilities There are some valid entries in spells.2da for which no symbolic constant is defined. Some of these likely were simply overlooked when the constants were defined, while others are spells whose development was halted (but whose scripts — possibly bugged — are still available). They are all listed here for completeness. See also *Commands: ** ActionCastFakeSpellAtLocation() ** ActionCastFakeSpellAtObject() ** ActionCastSpellAtLocation() ** ActionCastSpellAtObject() ** DecrementRemainingSpellUses() ** EffectSpellImmunity() ** EventSpellCastAt() ** GetEffectSpellId() ** GetHasSpell() ** GetHasSpellEffect() ** GetIdFromTalent() ** GetLastSpell() ** GetNearestCreature() ** GetNearestCreatureToLocation() ** GetSpellId() ** TalentSpell() Category:Constants